Skip to content

fix(cli): correct three refusals from #5008 - #5027

Merged
thymikee merged 3 commits into
callstack:mainfrom
imranbarbhuiya:fix/cli-args-followups
Nov 23, 2026
Merged

thymikee merged 3 commits into
callstack:mainfrom
imranbarbhuiya:fix/cli-args-followups

Conversation

@imranbarbhuiya

@imranbarbhuiya imranbarbhuiya commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #5008, from its review:

  • An int flag refusal said Expected integer, but the parser floors any number in range (open --timeout 1.5 runs with 1). It now says Expected number >= 1 (rounded down to an integer); accepted values do not change. Env and config refusals still say integer, since they refuse a fraction.
  • gesture drag read "," and "170," as coordinates, because an empty segment became 0. Such endpoints now reach the selector checks.
  • The daemon's fill decoder answered every decode error with a generic message. Fill positionals sent straight to the daemon now get the CLI's refusal: its message, hint and details.reason fill_target_missing. A --text-stdin or --record-as fill keeps the reason, with a message that does not echo its positionals. Untyped decode failures keep the generic response.

Before / after

Base aecafaf30, head d3228751f. Output of the CLI parser, the drag payload reader and selector parser, and the daemon fill decoder:

$ open com.example.app --timeout 0.5
base: Invalid timeout: 0.5. Expected integer >= 1.
head: Invalid timeout: 0.5. Expected number >= 1 (rounded down to an integer).
$ gesture drag "170," @e2
base: drag_endpoint_is_coordinates: gesture drag takes a @ref or selector for source and destination, not coordinates: "170,".
head: Invalid selector term "170,", expected key=value
$ fill 136849        # positionals sent straight to the daemon
base: fill requires x y text, @ref text, or selector text   (no reason)
head: fill_target_missing: fill needs <target> <text> but got one value, "136849". If a ref variable expanded to nothing, ...

Validation

  • Head d3228751f, check:affected --run --head, exactCommit: true: format, lint, typecheck, layering, fallow, build and vitest-related (441 tests) pass.
  • New tests cover --timeout 1.5 staying accepted and floored, ",", "170," and "170 , " drag endpoints, and fill with only its text through the daemon interaction handler, with and without --text-stdin/--record-as. Each fails with its fix reverted.
  • The fill_target_missing row in error-reasons.md stays put: scripts/reasons/generate.ts orders rows by table file path, then line.

Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

The refusal for an int flag said "Expected integer from 100 to 120000",
but the parser takes any number in range and floors it: open --timeout 1.5
runs with 1 while --timeout 0.5 is refused. The message now says
"Expected number >= 1 (rounded down to an integer)". Which values are
accepted does not change. Env and config values still say integer, since
those sources refuse a fraction.
…inate

readCoordinateEndpoint split "," into two empty segments and "170," into
"170" and one, and Number("") is 0, so gesture drag refused both as the
coordinates (0, 0) and (170, 0). An empty segment now makes the endpoint
no coordinate, so it reaches the selector checks like any other malformed
target.
parseFillTarget caught every decode error and answered with the generic
"fill requires x y text, @ref text, or selector text", so a client that
sent fill positionals straight to the daemon lost fill_target_missing and
its guidance. A decode refusal with a typed reason now reaches the caller
with the message, reason and hint the CLI reports; other decode failures
keep the generic response.

The decoder quotes the positionals, and a --text-stdin or --record-as
fill's lone positional may be the text itself, so a sensitive fill keeps
the reason with a message that echoes none of them.
@thymikee

Copy link
Copy Markdown
Member

Thanks for the quick fix. The PR is ready at d322875: the three corrected refusals trace cleanly through the changed routes, and the tests cover each regression. No conflicts. The only red marks are the two cancelled Body rules runs, which check the PR body text and share no route with this diff, and the other 15 checks pass. Not verified here: the tests and the CLI were not run locally, and the exact point where the late "Invalid selector term" refusal fires relative to device dispatch on the drag route was not confirmed. Not blocking, and fine to take or leave: (1) gesture drag "170," @e2 used to refuse before planning with drag_endpoint_is_coordinates, but now fails late in resolveInteractionTarget with no typed reason and no hint toward gesture pan; keeping a separator-only or trailing-separator token as a coordinate endpoint, without the pan hint, would preserve the typed reason (https://github.com/callstack/agent-device/blob/d322875/packages/gestures/src/gesture-payload-reader.ts#L306). (2) The sensitive branch words only the missing-target case but copies any error.details.reason, and the CLI's --text-stdin route uses a different reason (fill_text_stdin_target_invalid), so pinning the branch to fill_target_missing would keep wording and reason aligned (https://github.com/callstack/agent-device/blob/d322875/packages/daemon/src/execution/interaction/internal/interaction-touch-targets.ts#L291). (3) From #5008 and adjacent: on the CLI, fill $REF "pw" --record-as PW without --text-stdin still echoes the positionals in its fill_target_missing message, so routing --record-as fills through the same non-echoing read would match the daemon route (https://github.com/callstack/agent-device/blob/d322875/packages/command-surface/src/interaction/interactions.ts#L91). Before merge, the Body rules runs only need a re-run or to settle.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 23, 2026
@thymikee
thymikee merged commit dfcdbbc into callstack:main Nov 23, 2026
15 of 17 checks passed
@imranbarbhuiya
imranbarbhuiya deleted the fix/cli-args-followups branch November 23, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants